﻿<div>
    <div class="left_menu">
        <ul>
			<%
			
			
			sSQL = "select c.*,mi.url from category as c inner join menuitem as mi on c.id = mi.categoryid where c.isdeleted =0 and mi.menuid=2 and c.level=1"
			Set rs = DBLayer.GetRecordSet(sSQL)
			If rs.RecordCount <> 0 Then
				While Not rs.EOF
			%>
			<!--level 1-->
			<li class="mc"><a  href="<%If rs("url").Value <> "" Then Response.Write(rs("url").Value) Else Response.Write("Default.asp?act=category&id=" & rs("id").Value) End If%>"><%Response.Write(rs("name").Value) %></a></li>
			<%
					sSQLChild = "select c.*,mi.url from category as c inner join menuitem as mi on c.id = mi.categoryid where c.isdeleted =0 and mi.menuid=2 and c.level=2 and c.parentid =" & rs("id").Value
					Set rsChild = DBLayer.GetRecordSet(sSQLChild)
					If rsChild.RecordCount <> 0 Then
						While Not rsChild.EOF
						%>
							<!--level 2-->
							<li class="c"><a  href="<%If rsChild("url").Value <> "" Then Response.Write(rsChild("url").Value) Else Response.Write("Default.asp?act=category&id=" & rsChild("id").Value) End If%>"><%Response.Write(rsChild("name").Value) %></a></li>
							
							<%
							sSQLGrandChild = "select c.*,mi.url from category as c inner join menuitem as mi on c.id = mi.categoryid where c.isdeleted =0 and mi.menuid=2 and c.level=3 and c.parentid =" & rsChild("id").Value
							Set rsGrandChild = DBLayer.GetRecordSet(sSQLGrandChild)
							If rsGrandChild.RecordCount <> 0 Then
								While Not rsGrandChild.EOF
								%>
									<!--level 3-->
									<li class="sc"><a href="<%If rsGrandChild("url").Value <> "" Then Response.Write(rsGrandChild("url").Value) Else Response.Write("Default.asp?act=category&id=" & rsGrandChild("id").Value) End If%>"><%Response.Write(rsGrandChild("name").Value) %></a></li>
								<%
								rsGrandChild.MoveNext	
								Wend
								
							End If		
						
						rsChild.MoveNext	
						Wend
						
					End If					
						
					rs.MoveNext					
				Wend
			End If
			
			%>
            
        </ul>
    </div>
</div>
